package UnitTest.DataStructureTest.arrayAndListTest.listTest.listReverseTest;

import DataStructure.arrayAndList.list.Nodelj;
import DataStructure.arrayAndList.list.listReverse.ListReverseLastK;
import org.junit.Test;

public class ListReverseLastKTest {

    Nodelj node = new Nodelj();

    @Test
    public void test() {
        test(new ListReverseLastK());
    }

    public void test(ListReverseLastK instance) {
        Nodelj answer = instance.revise(node.Array2Nodelj(demo01), 2);
        assert node.equals(answer,node.Array2Nodelj(target01));
        answer = instance.revise(node.Array2Nodelj(demo02), 2);
        assert node.equals(answer,node.Array2Nodelj(target02));
        answer = instance.revise(node.Array2Nodelj(demo03), 2);
        assert node.equals(answer,node.Array2Nodelj(target03));
        answer = instance.revise(node.Array2Nodelj(demo04), 2);
        assert node.equals(answer,node.Array2Nodelj(target04));
        answer = instance.revise(node.Array2Nodelj(demo05), 10);
        assert node.equals(answer,node.Array2Nodelj(target05));
    }


    int[] demo01 = {1, 2, 3, 4, 5};
    int[] target01 = {5, 4, 1, 2, 3};
    int[] demo02 = null;
    int[] target02 = null;
    int[] demo03 = {};
    int[] target03 = null;
    int[] demo04 = {1};
    int[] target04 = {1};
    int[] demo05 = {1, 2, 3, 4, 5};
    int[] target05 = {1, 2, 3, 4, 5};
}
